<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class T_sekolah_identitas extends CI_Controller 
{
	function __construct()
	{
		parent::__construct();

		$this->load->library( 'template' ); 
		$this->load->model( 'model_t_sekolah_identitas' ); 
		
		$this->load->helper( 'form' );
		$this->load->helper( 'language' ); 
		$this->load->helper( 'url' );
        $this->load->model( 'model_auth' );

        $this->logged_in = $this->model_auth->check( TRUE );
        $this->template->assign( 'logged_in', $this->logged_in );

		$this->lang->load( 'db_fields', 'english' ); // This is the language file
	}



    /**
     *  LISTS MODEL DATA INTO A TABLE
     */         
    function index( $page = 0 )
    {
        $this->model_t_sekolah_identitas->pagination( TRUE );
		$data_info = $this->model_t_sekolah_identitas->lister( $page );
        $fields = $this->model_t_sekolah_identitas->fields( TRUE );
        

        $this->template->assign( 'pager', $this->model_t_sekolah_identitas->pager );
		$this->template->assign( 't_sekolah_identitas_fields', $fields );
		$this->template->assign( 't_sekolah_identitas_data', $data_info );
        $this->template->assign( 'table_name', 'T_sekolah_identitas' );
        $this->template->assign( 'template', 'list_t_sekolah_identitas' );
        
		$this->template->display( 'frame_admin.tpl' );
    }



    /**
     *  SHOWS A RECORD VIEW
     */
    function show( $id )
    {
		$data = $this->model_t_sekolah_identitas->get( $id );
        $fields = $this->model_t_sekolah_identitas->fields( TRUE );
        

        
        $this->template->assign( 'id', $id );
		$this->template->assign( 't_sekolah_identitas_fields', $fields );
		$this->template->assign( 't_sekolah_identitas_data', $data );
		$this->template->assign( 'table_name', 'T_sekolah_identitas' );
		$this->template->assign( 'template', 'show_t_sekolah_identitas' );
		$this->template->display( 'frame_admin.tpl' );
    }



    /**
     *  SHOWS A FROM, AND HANDLES SAVING IT
     */         
    function create( $id = false )
    {
		$this->load->library('form_validation');
        
		switch ( $_SERVER ['REQUEST_METHOD'] )
        {
            case 'GET':
                $fields = $this->model_t_sekolah_identitas->fields();
                
                
                
                $this->template->assign( 'action_mode', 'create' );
        		$this->template->assign( 't_sekolah_identitas_fields', $fields );
                $this->template->assign( 'metadata', $this->model_t_sekolah_identitas->metadata() );
        		$this->template->assign( 'table_name', 'T_sekolah_identitas' );
        		$this->template->assign( 'template', 'form_t_sekolah_identitas' );
        		$this->template->display( 'frame_admin.tpl' );
            break;

            /**
             *  Insert data TO t_sekolah_identitas table
             */
            case 'POST':
                $fields = $this->model_t_sekolah_identitas->fields();

                /* we set the rules */
                /* don't forget to edit these */
				$this->form_validation->set_rules( 'NSS', lang('NSS'), 'required|max_length[12]' );
				$this->form_validation->set_rules( 'KD_STATUS_SEKOLAH', lang('KD_STATUS_SEKOLAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'KD_BENTUK_SEKOLAH', lang('KD_BENTUK_SEKOLAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'KD_JENIS_SEKOLAH', lang('KD_JENIS_SEKOLAH'), 'required|max_length[2]' );
				$this->form_validation->set_rules( 'NIS', lang('NIS'), '12' );
				$this->form_validation->set_rules( 'NM_SEKOLAH', lang('NM_SEKOLAH'), 'required|max_length[50]' );
				$this->form_validation->set_rules( 'JALAN', lang('JALAN'), 'required|max_length[150]' );
				$this->form_validation->set_rules( 'KD_POS', lang('KD_POS'), '5' );
				$this->form_validation->set_rules( 'KD_DAERAH', lang('KD_DAERAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'ID_PROPINSI', lang('ID_PROPINSI'), 'required|max_length[3]|integer' );
				$this->form_validation->set_rules( 'ID_KABUPATEN', lang('ID_KABUPATEN'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'ID_KECAMATAN', lang('ID_KECAMATAN'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'KD_DESA', lang('KD_DESA'), 'required|max_length[50]' );
				$this->form_validation->set_rules( 'KD_AREA', lang('KD_AREA'), '5' );
				$this->form_validation->set_rules( 'NO_TELP', lang('NO_TELP'), '30' );
				$this->form_validation->set_rules( 'NO_FAX', lang('NO_FAX'), '30' );
				$this->form_validation->set_rules( 'EMAIL', lang('EMAIL'), '255' );
				$this->form_validation->set_rules( 'WEBSITE', lang('WEBSITE'), '50' );
				$this->form_validation->set_rules( 'JARAK_SKL_SJNS', lang('JARAK_SKL_SJNS'), '5' );
				$this->form_validation->set_rules( 'KD_WAKTU_PENYELENGGARAAN', lang('KD_WAKTU_PENYELENGGARAAN'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'TAHUN_DIBUKA', lang('TAHUN_DIBUKA'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'TAHUN_AKHIR_RENOV', lang('TAHUN_AKHIR_RENOV'), '5' );
				$this->form_validation->set_rules( 'NM_BANK', lang('NM_BANK'), '50' );
				$this->form_validation->set_rules( 'NO_REK_SEKOLAH', lang('NO_REK_SEKOLAH'), '20' );
				$this->form_validation->set_rules( 'NO_SK_PENDIRIAN', lang('NO_SK_PENDIRIAN'), '30' );
				$this->form_validation->set_rules( 'KD_KETERANGAN_SK', lang('KD_KETERANGAN_SK'), '1' );
				$this->form_validation->set_rules( 'NO_SK_AKHIR_STATUS', lang('NO_SK_AKHIR_STATUS'), '30' );
				$this->form_validation->set_rules( 'KD_AKREDITASI', lang('KD_AKREDITASI'), '1' );
				$this->form_validation->set_rules( 'NO_SK_AKREDITASI', lang('NO_SK_AKREDITASI'), '30' );
				$this->form_validation->set_rules( 'TAHUN_TUTUP', lang('TAHUN_TUTUP'), '5' );
				$this->form_validation->set_rules( 'KELILING_TANAH', lang('KELILING_TANAH'), '18' );
				$this->form_validation->set_rules( 'DIPAGAR_PERMANEN', lang('DIPAGAR_PERMANEN'), '18' );
				$this->form_validation->set_rules( 'STATUS_AKTIF', lang('STATUS_AKTIF'), '1' );
				$this->form_validation->set_rules( 'NPSN', lang('NPSN'), '8' );
				$this->form_validation->set_rules( 'KD_KLASIFIKASI_GEOGRAFIS', lang('KD_KLASIFIKASI_GEOGRAFIS'), '1' );
				$this->form_validation->set_rules( 'KD_KLASIFIKASI_SEKOLAH', lang('KD_KLASIFIKASI_SEKOLAH'), '1' );
				$this->form_validation->set_rules( 'INKLUSI', lang('INKLUSI'), '1' );
				$this->form_validation->set_rules( 'RT', lang('RT'), '3' );
				$this->form_validation->set_rules( 'RW', lang('RW'), '3' );
				$this->form_validation->set_rules( 'LATITUDE', lang('LATITUDE'), '9' );
				$this->form_validation->set_rules( 'LONGITUDE', lang('LONGITUDE'), '9' );
				$this->form_validation->set_rules( 'AKSES_INTERNET', lang('AKSES_INTERNET'), '1' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_JENIS', lang('AKSES_INTERNET_JENIS'), '2' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_LAINNYA', lang('AKSES_INTERNET_LAINNYA'), '100' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_BANDWIDTH', lang('AKSES_INTERNET_BANDWIDTH'), '1' );
				$this->form_validation->set_rules( 'STATUS_KEPEMILIKAN', lang('STATUS_KEPEMILIKAN'), '1' );
				$this->form_validation->set_rules( 'PND_TGN_SK_PENDIRIAN', lang('PND_TGN_SK_PENDIRIAN'), '100' );
				$this->form_validation->set_rules( 'NO_SK_OPERASIONAL', lang('NO_SK_OPERASIONAL'), '30' );
				$this->form_validation->set_rules( 'PND_TGN_SK_OPERASIONAL', lang('PND_TGN_SK_OPERASIONAL'), '100' );
				$this->form_validation->set_rules( 'NO_SK_AKREDITASI_AKHIR', lang('NO_SK_AKREDITASI_AKHIR'), '30' );
				$this->form_validation->set_rules( 'SERTIFIKASI_ISO', lang('SERTIFIKASI_ISO'), '1' );
				$this->form_validation->set_rules( 'GUGUS_SEKOLAH', lang('GUGUS_SEKOLAH'), '1' );
				$this->form_validation->set_rules( 'REK_ATAS_NAMA', lang('REK_ATAS_NAMA'), '100' );
				$this->form_validation->set_rules( 'STATUS_MBS', lang('STATUS_MBS'), '1' );
				$this->form_validation->set_rules( 'USERNAME', lang('USERNAME'), 'required|max_length[20]' );
				$this->form_validation->set_rules( 'TANGGAL_AKSES', lang('TANGGAL_AKSES'), 'required' );

				$data_post['NSS'] = $this->input->post( 'NSS' );
				$data_post['KD_STATUS_SEKOLAH'] = $this->input->post( 'KD_STATUS_SEKOLAH' );
				$data_post['KD_BENTUK_SEKOLAH'] = $this->input->post( 'KD_BENTUK_SEKOLAH' );
				$data_post['KD_JENIS_SEKOLAH'] = $this->input->post( 'KD_JENIS_SEKOLAH' );
				$data_post['NIS'] = $this->input->post( 'NIS' );
				$data_post['NM_SEKOLAH'] = $this->input->post( 'NM_SEKOLAH' );
				$data_post['JALAN'] = $this->input->post( 'JALAN' );
				$data_post['KD_POS'] = $this->input->post( 'KD_POS' );
				$data_post['KD_DAERAH'] = $this->input->post( 'KD_DAERAH' );
				$data_post['ID_PROPINSI'] = $this->input->post( 'ID_PROPINSI' );
				$data_post['ID_KABUPATEN'] = $this->input->post( 'ID_KABUPATEN' );
				$data_post['ID_KECAMATAN'] = $this->input->post( 'ID_KECAMATAN' );
				$data_post['KD_DESA'] = $this->input->post( 'KD_DESA' );
				$data_post['KD_AREA'] = $this->input->post( 'KD_AREA' );
				$data_post['NO_TELP'] = $this->input->post( 'NO_TELP' );
				$data_post['NO_FAX'] = $this->input->post( 'NO_FAX' );
				$data_post['EMAIL'] = $this->input->post( 'EMAIL' );
				$data_post['WEBSITE'] = $this->input->post( 'WEBSITE' );
				$data_post['JARAK_SKL_SJNS'] = $this->input->post( 'JARAK_SKL_SJNS' );
				$data_post['KD_WAKTU_PENYELENGGARAAN'] = $this->input->post( 'KD_WAKTU_PENYELENGGARAAN' );
				$data_post['TAHUN_DIBUKA'] = $this->input->post( 'TAHUN_DIBUKA' );
				$data_post['TAHUN_AKHIR_RENOV'] = $this->input->post( 'TAHUN_AKHIR_RENOV' );
				$data_post['NM_BANK'] = $this->input->post( 'NM_BANK' );
				$data_post['NO_REK_SEKOLAH'] = $this->input->post( 'NO_REK_SEKOLAH' );
				$data_post['NO_SK_PENDIRIAN'] = $this->input->post( 'NO_SK_PENDIRIAN' );
				$data_post['TANGGAL_SK_PENDIRIAN'] = $this->input->post( 'TANGGAL_SK_PENDIRIAN' );
				$data_post['KD_KETERANGAN_SK'] = $this->input->post( 'KD_KETERANGAN_SK' );
				$data_post['NO_SK_AKHIR_STATUS'] = $this->input->post( 'NO_SK_AKHIR_STATUS' );
				$data_post['TANGGAL_SK_AKHIR_STATUS'] = $this->input->post( 'TANGGAL_SK_AKHIR_STATUS' );
				$data_post['KD_AKREDITASI'] = $this->input->post( 'KD_AKREDITASI' );
				$data_post['NO_SK_AKREDITASI'] = $this->input->post( 'NO_SK_AKREDITASI' );
				$data_post['TANGGAL_SK_AKREDITASI'] = $this->input->post( 'TANGGAL_SK_AKREDITASI' );
				$data_post['TAHUN_TUTUP'] = $this->input->post( 'TAHUN_TUTUP' );
				$data_post['KELILING_TANAH'] = $this->input->post( 'KELILING_TANAH' );
				$data_post['DIPAGAR_PERMANEN'] = $this->input->post( 'DIPAGAR_PERMANEN' );
				$data_post['STATUS_AKTIF'] = $this->input->post( 'STATUS_AKTIF' );
				$data_post['NPSN'] = $this->input->post( 'NPSN' );
				$data_post['KD_KLASIFIKASI_GEOGRAFIS'] = $this->input->post( 'KD_KLASIFIKASI_GEOGRAFIS' );
				$data_post['KD_KLASIFIKASI_SEKOLAH'] = $this->input->post( 'KD_KLASIFIKASI_SEKOLAH' );
				$data_post['INKLUSI'] = $this->input->post( 'INKLUSI' );
				$data_post['RT'] = $this->input->post( 'RT' );
				$data_post['RW'] = $this->input->post( 'RW' );
				$data_post['LATITUDE'] = $this->input->post( 'LATITUDE' );
				$data_post['LONGITUDE'] = $this->input->post( 'LONGITUDE' );
				$data_post['AKSES_INTERNET'] = $this->input->post( 'AKSES_INTERNET' );
				$data_post['AKSES_INTERNET_JENIS'] = $this->input->post( 'AKSES_INTERNET_JENIS' );
				$data_post['AKSES_INTERNET_LAINNYA'] = $this->input->post( 'AKSES_INTERNET_LAINNYA' );
				$data_post['AKSES_INTERNET_BANDWIDTH'] = $this->input->post( 'AKSES_INTERNET_BANDWIDTH' );
				$data_post['STATUS_KEPEMILIKAN'] = $this->input->post( 'STATUS_KEPEMILIKAN' );
				$data_post['PND_TGN_SK_PENDIRIAN'] = $this->input->post( 'PND_TGN_SK_PENDIRIAN' );
				$data_post['NO_SK_OPERASIONAL'] = $this->input->post( 'NO_SK_OPERASIONAL' );
				$data_post['TANGGAL_SK_OPERASIONAL'] = $this->input->post( 'TANGGAL_SK_OPERASIONAL' );
				$data_post['PND_TGN_SK_OPERASIONAL'] = $this->input->post( 'PND_TGN_SK_OPERASIONAL' );
				$data_post['NO_SK_AKREDITASI_AKHIR'] = $this->input->post( 'NO_SK_AKREDITASI_AKHIR' );
				$data_post['TANGGAL_SK_AKREDITASI_AKHIR'] = $this->input->post( 'TANGGAL_SK_AKREDITASI_AKHIR' );
				$data_post['SERTIFIKASI_ISO'] = $this->input->post( 'SERTIFIKASI_ISO' );
				$data_post['GUGUS_SEKOLAH'] = $this->input->post( 'GUGUS_SEKOLAH' );
				$data_post['REK_ATAS_NAMA'] = $this->input->post( 'REK_ATAS_NAMA' );
				$data_post['STATUS_MBS'] = $this->input->post( 'STATUS_MBS' );
				$data_post['USERNAME'] = $this->input->post( 'USERNAME' );
				$data_post['TANGGAL_AKSES'] = $this->input->post( 'TANGGAL_AKSES' );

                if ( $this->form_validation->run() == FALSE )
                {
                    $errors = validation_errors();
                    
                    
                    
                    
              		$this->template->assign( 'errors', $errors );
              		$this->template->assign( 'action_mode', 'create' );
            		$this->template->assign( 't_sekolah_identitas_data', $data_post );
            		$this->template->assign( 't_sekolah_identitas_fields', $fields );
                    $this->template->assign( 'metadata', $this->model_t_sekolah_identitas->metadata() );
            		$this->template->assign( 'table_name', 'T_sekolah_identitas' );
            		$this->template->assign( 'template', 'form_t_sekolah_identitas' );
            		$this->template->display( 'frame_admin.tpl' );
                }
                elseif ( $this->form_validation->run() == TRUE )
                {
                    $insert_id = $this->model_t_sekolah_identitas->insert( $data_post );
                    
					redirect( 't_sekolah_identitas' );
                }
            break;
        }
    }



    /**
     *  DISPLAYS THE POPULATED FORM OF THE RECORD
     *  This method uses the same template as the create method
     */
    function edit( $id = false )
    {
        $this->load->library('form_validation');

        switch ( $_SERVER ['REQUEST_METHOD'] )
        {
            case 'GET':
                $this->model_t_sekolah_identitas->raw_data = TRUE;
        		$data = $this->model_t_sekolah_identitas->get( $id );
                $fields = $this->model_t_sekolah_identitas->fields();
                
                
                
                
          		$this->template->assign( 'action_mode', 'edit' );
        		$this->template->assign( 't_sekolah_identitas_data', $data );
        		$this->template->assign( 't_sekolah_identitas_fields', $fields );
                $this->template->assign( 'metadata', $this->model_t_sekolah_identitas->metadata() );
        		$this->template->assign( 'table_name', 'T_sekolah_identitas' );
        		$this->template->assign( 'template', 'form_t_sekolah_identitas' );
        		$this->template->assign( 'record_id', $id );
        		$this->template->display( 'frame_admin.tpl' );
            break;
    
            case 'POST':
    
                $fields = $this->model_t_sekolah_identitas->fields();
                /* we set the rules */
                /* don't forget to edit these */
				$this->form_validation->set_rules( 'NSS', lang('NSS'), 'required|max_length[12]' );
				$this->form_validation->set_rules( 'KD_STATUS_SEKOLAH', lang('KD_STATUS_SEKOLAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'KD_BENTUK_SEKOLAH', lang('KD_BENTUK_SEKOLAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'KD_JENIS_SEKOLAH', lang('KD_JENIS_SEKOLAH'), 'required|max_length[2]' );
				$this->form_validation->set_rules( 'NIS', lang('NIS'), '12' );
				$this->form_validation->set_rules( 'NM_SEKOLAH', lang('NM_SEKOLAH'), 'required|max_length[50]' );
				$this->form_validation->set_rules( 'JALAN', lang('JALAN'), 'required|max_length[150]' );
				$this->form_validation->set_rules( 'KD_POS', lang('KD_POS'), '5' );
				$this->form_validation->set_rules( 'KD_DAERAH', lang('KD_DAERAH'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'ID_PROPINSI', lang('ID_PROPINSI'), 'required|max_length[3]|integer' );
				$this->form_validation->set_rules( 'ID_KABUPATEN', lang('ID_KABUPATEN'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'ID_KECAMATAN', lang('ID_KECAMATAN'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'KD_DESA', lang('KD_DESA'), 'required|max_length[50]' );
				$this->form_validation->set_rules( 'KD_AREA', lang('KD_AREA'), '5' );
				$this->form_validation->set_rules( 'NO_TELP', lang('NO_TELP'), '30' );
				$this->form_validation->set_rules( 'NO_FAX', lang('NO_FAX'), '30' );
				$this->form_validation->set_rules( 'EMAIL', lang('EMAIL'), '255' );
				$this->form_validation->set_rules( 'WEBSITE', lang('WEBSITE'), '50' );
				$this->form_validation->set_rules( 'JARAK_SKL_SJNS', lang('JARAK_SKL_SJNS'), '5' );
				$this->form_validation->set_rules( 'KD_WAKTU_PENYELENGGARAAN', lang('KD_WAKTU_PENYELENGGARAAN'), 'required|max_length[1]' );
				$this->form_validation->set_rules( 'TAHUN_DIBUKA', lang('TAHUN_DIBUKA'), 'required|max_length[5]|integer' );
				$this->form_validation->set_rules( 'TAHUN_AKHIR_RENOV', lang('TAHUN_AKHIR_RENOV'), '5' );
				$this->form_validation->set_rules( 'NM_BANK', lang('NM_BANK'), '50' );
				$this->form_validation->set_rules( 'NO_REK_SEKOLAH', lang('NO_REK_SEKOLAH'), '20' );
				$this->form_validation->set_rules( 'NO_SK_PENDIRIAN', lang('NO_SK_PENDIRIAN'), '30' );
				$this->form_validation->set_rules( 'KD_KETERANGAN_SK', lang('KD_KETERANGAN_SK'), '1' );
				$this->form_validation->set_rules( 'NO_SK_AKHIR_STATUS', lang('NO_SK_AKHIR_STATUS'), '30' );
				$this->form_validation->set_rules( 'KD_AKREDITASI', lang('KD_AKREDITASI'), '1' );
				$this->form_validation->set_rules( 'NO_SK_AKREDITASI', lang('NO_SK_AKREDITASI'), '30' );
				$this->form_validation->set_rules( 'TAHUN_TUTUP', lang('TAHUN_TUTUP'), '5' );
				$this->form_validation->set_rules( 'KELILING_TANAH', lang('KELILING_TANAH'), '18' );
				$this->form_validation->set_rules( 'DIPAGAR_PERMANEN', lang('DIPAGAR_PERMANEN'), '18' );
				$this->form_validation->set_rules( 'STATUS_AKTIF', lang('STATUS_AKTIF'), '1' );
				$this->form_validation->set_rules( 'NPSN', lang('NPSN'), '8' );
				$this->form_validation->set_rules( 'KD_KLASIFIKASI_GEOGRAFIS', lang('KD_KLASIFIKASI_GEOGRAFIS'), '1' );
				$this->form_validation->set_rules( 'KD_KLASIFIKASI_SEKOLAH', lang('KD_KLASIFIKASI_SEKOLAH'), '1' );
				$this->form_validation->set_rules( 'INKLUSI', lang('INKLUSI'), '1' );
				$this->form_validation->set_rules( 'RT', lang('RT'), '3' );
				$this->form_validation->set_rules( 'RW', lang('RW'), '3' );
				$this->form_validation->set_rules( 'LATITUDE', lang('LATITUDE'), '9' );
				$this->form_validation->set_rules( 'LONGITUDE', lang('LONGITUDE'), '9' );
				$this->form_validation->set_rules( 'AKSES_INTERNET', lang('AKSES_INTERNET'), '1' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_JENIS', lang('AKSES_INTERNET_JENIS'), '2' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_LAINNYA', lang('AKSES_INTERNET_LAINNYA'), '100' );
				$this->form_validation->set_rules( 'AKSES_INTERNET_BANDWIDTH', lang('AKSES_INTERNET_BANDWIDTH'), '1' );
				$this->form_validation->set_rules( 'STATUS_KEPEMILIKAN', lang('STATUS_KEPEMILIKAN'), '1' );
				$this->form_validation->set_rules( 'PND_TGN_SK_PENDIRIAN', lang('PND_TGN_SK_PENDIRIAN'), '100' );
				$this->form_validation->set_rules( 'NO_SK_OPERASIONAL', lang('NO_SK_OPERASIONAL'), '30' );
				$this->form_validation->set_rules( 'PND_TGN_SK_OPERASIONAL', lang('PND_TGN_SK_OPERASIONAL'), '100' );
				$this->form_validation->set_rules( 'NO_SK_AKREDITASI_AKHIR', lang('NO_SK_AKREDITASI_AKHIR'), '30' );
				$this->form_validation->set_rules( 'SERTIFIKASI_ISO', lang('SERTIFIKASI_ISO'), '1' );
				$this->form_validation->set_rules( 'GUGUS_SEKOLAH', lang('GUGUS_SEKOLAH'), '1' );
				$this->form_validation->set_rules( 'REK_ATAS_NAMA', lang('REK_ATAS_NAMA'), '100' );
				$this->form_validation->set_rules( 'STATUS_MBS', lang('STATUS_MBS'), '1' );
				$this->form_validation->set_rules( 'USERNAME', lang('USERNAME'), 'required|max_length[20]' );
				$this->form_validation->set_rules( 'TANGGAL_AKSES', lang('TANGGAL_AKSES'), 'required' );

				$data_post['NSS'] = $this->input->post( 'NSS' );
				$data_post['KD_STATUS_SEKOLAH'] = $this->input->post( 'KD_STATUS_SEKOLAH' );
				$data_post['KD_BENTUK_SEKOLAH'] = $this->input->post( 'KD_BENTUK_SEKOLAH' );
				$data_post['KD_JENIS_SEKOLAH'] = $this->input->post( 'KD_JENIS_SEKOLAH' );
				$data_post['NIS'] = $this->input->post( 'NIS' );
				$data_post['NM_SEKOLAH'] = $this->input->post( 'NM_SEKOLAH' );
				$data_post['JALAN'] = $this->input->post( 'JALAN' );
				$data_post['KD_POS'] = $this->input->post( 'KD_POS' );
				$data_post['KD_DAERAH'] = $this->input->post( 'KD_DAERAH' );
				$data_post['ID_PROPINSI'] = $this->input->post( 'ID_PROPINSI' );
				$data_post['ID_KABUPATEN'] = $this->input->post( 'ID_KABUPATEN' );
				$data_post['ID_KECAMATAN'] = $this->input->post( 'ID_KECAMATAN' );
				$data_post['KD_DESA'] = $this->input->post( 'KD_DESA' );
				$data_post['KD_AREA'] = $this->input->post( 'KD_AREA' );
				$data_post['NO_TELP'] = $this->input->post( 'NO_TELP' );
				$data_post['NO_FAX'] = $this->input->post( 'NO_FAX' );
				$data_post['EMAIL'] = $this->input->post( 'EMAIL' );
				$data_post['WEBSITE'] = $this->input->post( 'WEBSITE' );
				$data_post['JARAK_SKL_SJNS'] = $this->input->post( 'JARAK_SKL_SJNS' );
				$data_post['KD_WAKTU_PENYELENGGARAAN'] = $this->input->post( 'KD_WAKTU_PENYELENGGARAAN' );
				$data_post['TAHUN_DIBUKA'] = $this->input->post( 'TAHUN_DIBUKA' );
				$data_post['TAHUN_AKHIR_RENOV'] = $this->input->post( 'TAHUN_AKHIR_RENOV' );
				$data_post['NM_BANK'] = $this->input->post( 'NM_BANK' );
				$data_post['NO_REK_SEKOLAH'] = $this->input->post( 'NO_REK_SEKOLAH' );
				$data_post['NO_SK_PENDIRIAN'] = $this->input->post( 'NO_SK_PENDIRIAN' );
				$data_post['TANGGAL_SK_PENDIRIAN'] = $this->input->post( 'TANGGAL_SK_PENDIRIAN' );
				$data_post['KD_KETERANGAN_SK'] = $this->input->post( 'KD_KETERANGAN_SK' );
				$data_post['NO_SK_AKHIR_STATUS'] = $this->input->post( 'NO_SK_AKHIR_STATUS' );
				$data_post['TANGGAL_SK_AKHIR_STATUS'] = $this->input->post( 'TANGGAL_SK_AKHIR_STATUS' );
				$data_post['KD_AKREDITASI'] = $this->input->post( 'KD_AKREDITASI' );
				$data_post['NO_SK_AKREDITASI'] = $this->input->post( 'NO_SK_AKREDITASI' );
				$data_post['TANGGAL_SK_AKREDITASI'] = $this->input->post( 'TANGGAL_SK_AKREDITASI' );
				$data_post['TAHUN_TUTUP'] = $this->input->post( 'TAHUN_TUTUP' );
				$data_post['KELILING_TANAH'] = $this->input->post( 'KELILING_TANAH' );
				$data_post['DIPAGAR_PERMANEN'] = $this->input->post( 'DIPAGAR_PERMANEN' );
				$data_post['STATUS_AKTIF'] = $this->input->post( 'STATUS_AKTIF' );
				$data_post['NPSN'] = $this->input->post( 'NPSN' );
				$data_post['KD_KLASIFIKASI_GEOGRAFIS'] = $this->input->post( 'KD_KLASIFIKASI_GEOGRAFIS' );
				$data_post['KD_KLASIFIKASI_SEKOLAH'] = $this->input->post( 'KD_KLASIFIKASI_SEKOLAH' );
				$data_post['INKLUSI'] = $this->input->post( 'INKLUSI' );
				$data_post['RT'] = $this->input->post( 'RT' );
				$data_post['RW'] = $this->input->post( 'RW' );
				$data_post['LATITUDE'] = $this->input->post( 'LATITUDE' );
				$data_post['LONGITUDE'] = $this->input->post( 'LONGITUDE' );
				$data_post['AKSES_INTERNET'] = $this->input->post( 'AKSES_INTERNET' );
				$data_post['AKSES_INTERNET_JENIS'] = $this->input->post( 'AKSES_INTERNET_JENIS' );
				$data_post['AKSES_INTERNET_LAINNYA'] = $this->input->post( 'AKSES_INTERNET_LAINNYA' );
				$data_post['AKSES_INTERNET_BANDWIDTH'] = $this->input->post( 'AKSES_INTERNET_BANDWIDTH' );
				$data_post['STATUS_KEPEMILIKAN'] = $this->input->post( 'STATUS_KEPEMILIKAN' );
				$data_post['PND_TGN_SK_PENDIRIAN'] = $this->input->post( 'PND_TGN_SK_PENDIRIAN' );
				$data_post['NO_SK_OPERASIONAL'] = $this->input->post( 'NO_SK_OPERASIONAL' );
				$data_post['TANGGAL_SK_OPERASIONAL'] = $this->input->post( 'TANGGAL_SK_OPERASIONAL' );
				$data_post['PND_TGN_SK_OPERASIONAL'] = $this->input->post( 'PND_TGN_SK_OPERASIONAL' );
				$data_post['NO_SK_AKREDITASI_AKHIR'] = $this->input->post( 'NO_SK_AKREDITASI_AKHIR' );
				$data_post['TANGGAL_SK_AKREDITASI_AKHIR'] = $this->input->post( 'TANGGAL_SK_AKREDITASI_AKHIR' );
				$data_post['SERTIFIKASI_ISO'] = $this->input->post( 'SERTIFIKASI_ISO' );
				$data_post['GUGUS_SEKOLAH'] = $this->input->post( 'GUGUS_SEKOLAH' );
				$data_post['REK_ATAS_NAMA'] = $this->input->post( 'REK_ATAS_NAMA' );
				$data_post['STATUS_MBS'] = $this->input->post( 'STATUS_MBS' );
				$data_post['USERNAME'] = $this->input->post( 'USERNAME' );
				$data_post['TANGGAL_AKSES'] = $this->input->post( 'TANGGAL_AKSES' );

                if ( $this->form_validation->run() == FALSE )
                {
                    $errors = validation_errors();
                    
                    
                    
                    
              		$this->template->assign( 'action_mode', 'edit' );
              		$this->template->assign( 'errors', $errors );
            		$this->template->assign( 't_sekolah_identitas_data', $data_post );
            		$this->template->assign( 't_sekolah_identitas_fields', $fields );
                    $this->template->assign( 'metadata', $this->model_t_sekolah_identitas->metadata() );
            		$this->template->assign( 'table_name', 'T_sekolah_identitas' );
            		$this->template->assign( 'template', 'form_t_sekolah_identitas' );
        		    $this->template->assign( 'record_id', $id );
            		$this->template->display( 'frame_admin.tpl' );
                }
                elseif ( $this->form_validation->run() == TRUE )
                {
				    $this->model_t_sekolah_identitas->update( $id, $data_post );
				    
					redirect( 't_sekolah_identitas/show/' . $id );   
                }
            break;
        }
    }



    /**
     *  DELETE RECORD(S)
     *  The 'delete' method of the model accepts int and array  
     */
    function delete( $id = FALSE )
    {
        switch ( $_SERVER ['REQUEST_METHOD'] )
        {
            case 'GET':
                $this->model_t_sekolah_identitas->delete( $id );
                redirect( $_SERVER['HTTP_REFERER'] );
            break;

            case 'POST':
                $this->model_t_sekolah_identitas->delete( $this->input->post('delete_ids') );
                redirect( $_SERVER['HTTP_REFERER'] );
            break;
        }
    }
}
